namespace IrisGenerator.Common.DatabaseModel.DataAccess
{
    using System;
    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Data;
    using System.Xml;
    using IrisGenerator.Dal;
    
    
    public partial class Column : IDisposable {
        
        private DataAccess _dataAccess;
        
        public Column() {
            this._dataAccess = new DataAccess();
        }
        
        public virtual System.Data.DataSet Select_COLUMN_By_MET_ID(System.Nullable<System.Guid> MET_ID) {
            this._dataAccess.CreateProcedureCommand("sp_Select_COLUMN_By_MET_ID");
            this._dataAccess.AddParameter("MET_ID", MET_ID, ParameterDirection.Input);
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Data.DataSet Select_COLUMN_By_TAB_ID(System.Nullable<System.Guid> TAB_ID) {
            this._dataAccess.CreateProcedureCommand("sp_Select_COLUMNs_By_TAB_ID");
            this._dataAccess.AddParameter("TAB_ID", TAB_ID, ParameterDirection.Input);
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Data.DataSet COLUMN_Select_All() {
            this._dataAccess.CreateProcedureCommand("sp_COLUMN_Select_All");
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Data.DataSet COLUMN_Select_One(System.Nullable<System.Guid> COL_ID) {
            this._dataAccess.CreateProcedureCommand("sp_COLUMN_Select_One");
            this._dataAccess.AddParameter("COL_ID", COL_ID, ParameterDirection.Input);
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Nullable<System.Guid> COLUMN_Insert(System.Nullable<System.Guid> TAB_ID, System.Nullable<System.Guid> MET_ID, string COL_NAME, string COL_FORMATED_NAME, System.Nullable<int> COL_PRECISION, string COL_LENGTH, System.Nullable<bool> COL_NULLABLE, System.Nullable<bool> COL_COMPUTED, System.Nullable<bool> COL_SEQUENTIAL, System.Nullable<int> COL_GENERATE_VALUE) {
            this._dataAccess.CreateProcedureCommand("sp_COLUMN_Insert");
            this._dataAccess.AddParameter("TAB_ID", TAB_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("MET_ID", MET_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_NAME", COL_NAME, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_FORMATED_NAME", COL_FORMATED_NAME, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_PRECISION", COL_PRECISION, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_LENGTH", COL_LENGTH, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_NULLABLE", COL_NULLABLE, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_COMPUTED", COL_COMPUTED, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_SEQUENTIAL", COL_SEQUENTIAL, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_GENERATE_VALUE", COL_GENERATE_VALUE, ParameterDirection.Input);
            Guid value = ((Guid)(this._dataAccess.ExecuteScalar()));
            return value;
        }
        
        public virtual System.Nullable<int> COLUMN_Delete(System.Nullable<System.Guid> COL_ID) {
            this._dataAccess.CreateProcedureCommand("sp_COLUMN_Delete");
            this._dataAccess.AddParameter("COL_ID", COL_ID, ParameterDirection.Input);
            int value = this._dataAccess.ExecuteNonQuery();
            return value;
        }
        
        public virtual System.Nullable<int> COLUMN_Update(System.Nullable<System.Guid> COL_ID, System.Nullable<System.Guid> TAB_ID, System.Nullable<System.Guid> MET_ID, string COL_NAME, string COL_FORMATED_NAME, System.Nullable<int> COL_PRECISION, string COL_LENGTH, System.Nullable<bool> COL_NULLABLE, System.Nullable<bool> COL_COMPUTED, System.Nullable<bool> COL_SEQUENTIAL, System.Nullable<int> COL_GENERATE_VALUE) {
            this._dataAccess.CreateProcedureCommand("sp_COLUMN_Update");
            this._dataAccess.AddParameter("COL_ID", COL_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("TAB_ID", TAB_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("MET_ID", MET_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_NAME", COL_NAME, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_FORMATED_NAME", COL_FORMATED_NAME, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_PRECISION", COL_PRECISION, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_LENGTH", COL_LENGTH, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_NULLABLE", COL_NULLABLE, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_COMPUTED", COL_COMPUTED, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_SEQUENTIAL", COL_SEQUENTIAL, ParameterDirection.Input);
            this._dataAccess.AddParameter("COL_GENERATE_VALUE", COL_GENERATE_VALUE, ParameterDirection.Input);
            int value = this._dataAccess.ExecuteNonQuery();
            return value;
        }
        
        public virtual void Dispose() {
            if ((this._dataAccess != null)) {
                this._dataAccess.Dispose();
            }
        }
    }
}
